package com.sgchen.demo.config;

import com.sgchen.security.config.SecretConfig;
import com.sgchen.security.enums.RequestAsymmetricMode;
import com.sgchen.security.enums.RequestSolveMode;
import com.sgchen.security.enums.SecretAlgorithm;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author sgchen
 * @date 2025/6/4 9:05
 */
//@Configuration
public class DataSecurityConfig {

    /**
     * 请求参数加密的key
     */
    @Value("${project.secretKey:0123456789abcdeffedcba9876543210}")
    private String secretKey;

    @Value("${project.secretDbKey:testtest12345678}")
    private String secretDbKey;


    @Bean
    public SecretConfig secretConfig() {
        return SecretConfig.builder()
                .reqSecretKey(secretKey)
                .reqAlgorithm(SecretAlgorithm.PKCS7)
                .requestSolveMode(RequestSolveMode.FIELD)
//                .requestAsymmetricMode(RequestAsymmetricMode.SM2_WITH_HEADER)
                .dbSecretKey("testtest12345678")
                .dbAlgorithm(SecretAlgorithm.PKCS7)
                .build();
    }

}
